package com.hspedu.poly_.detail_;

public class PolyDetail03 {
    public static void main(String[] args) {
        BB bb = new BB();
        System.out.println(bb instanceof BB);
        System.out.println(bb instanceof AA);//true
        //bb是AA嘛或者AA的类型的子类

        //编译类型：AA
        //运行类型：BB
        AA aa = new BB();
        System.out.println(aa instanceof  BB);//true
        //这里看的是运行类型而不是编译类型
        System.out.println(aa instanceof AA);//true

        Object obj = new Object();
        System.out.println(obj instanceof AA);//false
        String str = "hello";
//        System.out.println(str instanceof AA);
        System.out.println(str instanceof Object);//true


    }
}

class AA{//父类

}

class BB extends AA{

}
